package com.hq.modeapp.bean;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


public class Photo_Specific_Bean {
		
	private ArrayList<Photo_Bean> photos;//图片集
	private String setname;//标题
	private String imgsum;//图片数量
	public ArrayList<Photo_Bean> getPhotos() {
		return photos;
	}
	public void setPhotos(ArrayList<Photo_Bean> photos) {
		this.photos = photos;
	}
	public String getSetname() {
		return setname;
	}
	public void setSetname(String setname) {
		this.setname = setname;
	}
	public String getImgsum() {
		return imgsum;
	}
	public void setImgsum(String imgsum) {
		this.imgsum = imgsum;
	}
	public static Photo_Specific_Bean parseJson(String str) {
		Photo_Specific_Bean bean = new Photo_Specific_Bean();
		try {
			
			JSONObject jsonObject = new JSONObject(str);
			bean.setSetname(jsonObject.getString("setname"));
			bean.setImgsum(jsonObject.getString("imgsum"));
			JSONArray jsonArray;
			jsonArray = new JSONArray(jsonObject.getString("photos"));
			ArrayList<Photo_Bean> list = new ArrayList<Photo_Bean>();
			int n = jsonArray.length();
			for (int i = 0; i < n; i++) {
				Photo_Bean photo_Bean = new Photo_Bean();
				photo_Bean.setNote(jsonArray.getJSONObject(i).getString("note"));
				photo_Bean.setImgurl(jsonArray.getJSONObject(i).getString("imgurl"));
				list.add(photo_Bean);
			}
			bean.setPhotos(list);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;

	}
	
}
